dispatchNestedScroll

open fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>): Boolean(source)

Dispatch one step of a nested scroll in progress.

This version of the method just calls dispatchNestedScroll using the touch input type.

Return

true if the event was dispatched, false if it could not be dispatched.

Parameters

view

view for which to dispatch the scroll.

dxConsumed

Horizontal distance in pixels consumed by this view during this scroll step

dyConsumed

Vertical distance in pixels consumed by this view during this scroll step

dxUnconsumed

Horizontal scroll distance in pixels not consumed by this view

dyUnconsumed

Horizontal scroll distance in pixels not consumed by this view

offsetInWindow

Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.


open fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>, type: Int, @NonNull consumed: Array<Int>)(source)

Dispatch one step of a nested scroll in progress.

Implementations of views that support nested scrolling should call this to report info about a scroll in progress to the current nested scrolling parent. If a nested scroll is not currently in progress or nested scrolling is not enabled for this view this method does nothing.

Compatible View implementations should also call dispatchNestedPreScroll before consuming a component of the scroll event themselves.

A non-null consumed int array of length 2 may be passed in to enable nested scrolling parents to report how much of the scroll distance was consumed. The original caller (where the input event was received to start the scroll) should initialize the values to be 0, in order to tell how much was actually consumed up the hierarchy of scrolling parents.

Parameters

view

view for which to dispatch the scroll.

dxConsumed

Horizontal distance in pixels consumed by this view during this scroll step

dyConsumed

Vertical distance in pixels consumed by this view during this scroll step

dxUnconsumed

Horizontal scroll distance in pixels not consumed by this view

dyUnconsumed

Horizontal scroll distance in pixels not consumed by this view

offsetInWindow

Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.

type

the type of input which cause this scroll event

consumed

Output, If not null, consumed[0] will contain the consumed component of dx and consumed[1] the consumed dy.


open fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>, type: Int): Boolean(source)

Dispatch one step of a nested scroll in progress.

Implementations of views that support nested scrolling should call this to report info about a scroll in progress to the current nested scrolling parent. If a nested scroll is not currently in progress or nested scrolling is not enabled for this view this method does nothing.

Compatible View implementations should also call dispatchNestedPreScroll before consuming a component of the scroll event themselves.

Return

true if the event was dispatched, and therefore the scroll distance was consumed

Parameters

view

view for which to dispatch the scroll.

dxConsumed

Horizontal distance in pixels consumed by this view during this scroll step

dyConsumed

Vertical distance in pixels consumed by this view during this scroll step

dxUnconsumed

Horizontal scroll distance in pixels not consumed by this view

dyUnconsumed

Horizontal scroll distance in pixels not consumed by this view

offsetInWindow

Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.

type

the type of input which cause this scroll event

See also